<template>
  <!-- 加盟推荐组件 -->
  <!-- 加盟推荐组件 -->
  <div class="recommends">
    <div>
      <span>{{ recommends.tit }}</span>
      <button>{{ recommends.moreMsg }}</button>
    </div>
    <ul>
      <li v-for="(item,index) in recommends.data" :key="index">
        <div class="imgBox">
          <img :src="item.img">
        </div>
        <hr>
        <p>{{ item.name }}</p>
        <p>{{ item.describe }}</p>
        <button @click="popJoin">{{ item.iDo }}</button>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    // eslint-disable-next-line vue/require-default-prop
    'recommends': {
      type: Object,
      require: true
    }
  },
  data() {
    return {
      /* 组件默认数据格式 */
      /* tjMsg:{
				tit: '为你推荐',
				moreMsg: '查看更多',
				data: [
					{
						img: require('../../../assets/img/search-list/defaultLogo.png'),
						name: '迪士尼',
						describe: '专业制造100年',
						iDo: '我要加盟'
					},
					{
						img: require('../../../assets/img/search-list/defaultLogo.png'),
						name: '哈士奇',
						describe: '专业制造100年',
						iDo: '我要加盟'
					},
					{
						img: require('../../../assets/img/search-list/defaultLogo.png'),
						name: '万达地产',
						describe: '专业制造100年',
						iDo: '我要加盟'
					}
				]
      } */

    }
  },
  methods: {
    popJoin() {
      this.$store.commit('template1/changePopJoin', true)
    }
  }

}
</script>

<style lang="scss" scoped>
.recommends {
  width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  background-color: #fff;
  margin-bottom: 20px;
  > div {
    height: 82px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    > span {
      font-size: 24px;
      color: #333;
    }
    > button {
      font-size: 14px;
      color: #333;
      background-color: transparent;
      cursor: pointer;
    }
  }
  > ul {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    padding-top: 20px;
    height: 252px;
    > li {
      width: 201px;
      height: 202px;
      cursor: pointer;
      border: 1px solid #ebebeb;
      >.imgBox{
        width: 80%;
        height: 105px;
        margin: 0 auto;
        display: flex;
        flex-flow: row nowrap;
        justify-content: center;
        align-items: center;
        > img {
          display: block;
          max-height: 90px;
          max-width: 160px;
        }
      }

      > hr {
        width: 72%;
        margin-top: 0;
        margin-bottom: 15px;
        height: 1px;
        background-color: #ebebeb;
        border: none;
      }
      > p:nth-child(3) {
        font-size: 16px;
        color: #333;
        text-align: center;
        margin-bottom: 12px;
      }
      > p:nth-child(4) {
        font-size: 12px;
        color: #999;
        text-align: center;
      }
      > button {
        display: none;
      }
    }
    li:hover {
      > p:nth-child(4) {
        display: none;
      }
      > button {
        display: block;
        width: 100px;
        height: 30px;
        background-color: #417aef;
        border-radius: 4px;
        font-size: 14px;
        color: #fff;
        text-align: center;
        line-height: 30px;
        margin: 0 auto;
        cursor: pointer;
      }
    }
  }
}
</style>
